{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "672c3c56",
   "metadata": {},
   "source": [
    "# 元组（tuple）\n",
    "\n",
    "> 1.它是和list几乎完全一样的序列数据\n",
    "> 2.它与list不同的地方是，**不可变**（因为不可变，所以几乎没有方法）\n",
    "> 3.元组的形式： （1，2，34，5） 对比 元组（） 列表[]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "325b767e",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "('10001', '10002', '10003', '10001') <class 'tuple'>\n"
     ]
    }
   ],
   "source": [
    "stu_id = \"10001\",\"10002\",\"10003\",\"10001\"\n",
    "print(stu_id,type(stu_id))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "id": "bc60bff2",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "2"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "stu_id.count(\"10001\")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "4547069b",
   "metadata": {},
   "source": [
    "# 字典\n",
    "\n",
    "> 1. 创建字典的三种常见的方法\n",
    ">> 1. 直接按照字典的格式创建 ： {key1:value1 , key2:value2,...}\n",
    ">> 2. dict（）函数来创建字典： dict（key1=value，key2value2，...）\n",
    ">> 3. 字典数据增加的方式： 新疆空字典 dict_name={}，dict_name[key1]=value"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "id": "3b7ba62b",
   "metadata": {},
   "outputs": [
    {
     "ename": "NameError",
     "evalue": "name 'stu_info' is not defined",
     "output_type": "error",
     "traceback": [
      "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[0;31mNameError\u001b[0m                                 Traceback (most recent call last)",
      "\u001b[0;32m<ipython-input-15-f121c61aeb35>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[1;32m      5\u001b[0m     \u001b[0;34m\"stu_10003\"\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\"Marry\"\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m      6\u001b[0m }\n\u001b[0;32m----> 7\u001b[0;31m \u001b[0mstu_info\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m",
      "\u001b[0;31mNameError\u001b[0m: name 'stu_info' is not defined"
     ]
    }
   ],
   "source": [
    "# 1. 直接按照字典的格式创建 ： {key1:value,key2:value2,....}\n",
    "stud_info = {\n",
    "    \"stu_10001\":\"Alex\",\n",
    "    \"stu_10002\":\"Jack\",\n",
    "    \"stu_10003\":\"Marry\"\n",
    "}\n",
    "stu_info"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "62e488d1",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "4e93ab25",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "hide_input": false,
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.8"
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": true,
   "sideBar": true,
   "skip_h1_title": false,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {},
   "toc_section_display": true,
   "toc_window_display": false
  },
  "varInspector": {
   "cols": {
    "lenName": 16,
    "lenType": 16,
    "lenVar": 40
   },
   "kernels_config": {
    "python": {
     "delete_cmd_postfix": "",
     "delete_cmd_prefix": "del ",
     "library": "var_list.py",
     "varRefreshCmd": "print(var_dic_list())"
    },
    "r": {
     "delete_cmd_postfix": ") ",
     "delete_cmd_prefix": "rm(",
     "library": "var_list.r",
     "varRefreshCmd": "cat(var_dic_list()) "
    }
   },
   "types_to_exclude": [
    "module",
    "function",
    "builtin_function_or_method",
    "instance",
    "_Feature"
   ],
   "window_display": false
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
